<include file="../header" />
<div id="left-sider"><include file="../left-sider" /></div>
<div id="main">
  <div class="main-hd">
    <h2>每月之星</h2>
  </div>
  <div class="main-bd">
  <form id="starToDelForm" action="remove" method="post" target="_self">
    <div>
      <p>
        <input type="submit" value="删除" />
        <a href="create">新增</a></p>
    </div>
    <div>
      <table width="100%" border="1" class="table-list">
        <tr>
          <th><input type="checkbox" id="starToDelCtrl"/></th>
          <th>Name</th>
          <th>Year</th>
          <th>Major</th>
          <th>Hobby</th>
          <th>Respon.</th>
          <th>Self-introduction</th>
          <th>Image</th>
          <th>Note</th>
          <th>Language</th>
        </tr>
        <volist name="stars" id="star">
          <tr>
            <td class="text-center"><input class="starToDel" type="checkbox" name="starToDel[]" value="{$star.id}"/></td>
            <td><a href="edit/id/{$star.id}" target="_self">{$star.name}</a></td>
            <td>{$star.year}</td>
            <td>{$star.major}</td>
            <td>{$star.hobby}</td>
            <td>{$star.respon}</td>
            <td>{$star.intro|String::msubstr=0,20,"utf-8",true}</td>
            <td><img src="/Uploads/faces/{$star.faceimg}" alt="{$star.facenote}"/></td>
            <td>{$star.facenote}</td>
            <td>{$star.lang}</td>
          </tr>
        </volist>
      </table>
    </div>
    </div>
    <input name="t" type="hidden" value="del" />
  </form>
</div>
<include file="../footer" /> 
<script type="text/javascript">
var starToDel = document.querySelectorAll('.starToDel');
document.getElementById('starToDelCtrl').addEventListener('click',function(){
		if(this.checked) {
			for(var i=0; i<starToDel.length; i++) {
				starToDel[i].checked = true;
			}
		} else {
			for(var i=0; i<starToDel.length; i++) {
				starToDel[i].checked = false;
			}
		}
}, false);

document.getElementById('starToDelForm').addEventListener('submit',function(e){
		if(!confirm('删除后无法恢复，你是否要继续？')) {
				e.preventDefault();
				return false;
		}
}, false);
</script>